package ua.kpi.ipsa.expert.api.db;

import java.util.List;

import ua.kpi.ipsa.expert.api.algorithm.Algorithm;

/**
 * DAO is meant to be personal. Please feel free to add your methods. But you
 * are encouraged to use the same philosofy.
 * 
 * @author Admin
 */
public interface DAO {

	/**
	 * @param example
	 *            содержит критерии поиска
	 */
	public List<CodePortionTuple> getCodePortionsByExample(
			CodePortionTuple example, long toTime) throws DataAccessException;

	public void setCodePortion(CodePortionTuple codePortion)
			throws DataAccessException;

	public List<AssignedAlgorithmTuple> getAssignedAlgorithms(int portionFK)
			throws DataAccessException;

	public AlgorithmTuple getAlgorithm(int algorithmPK)
			throws DataAccessException;

	public List<AlgorithmTuple> getAlgorithms() throws DataAccessException;

	public void setAssignedAlgorithm(AssignedAlgorithmTuple algo)
			throws DataAccessException;

	public List<PlagiarismHypoTuple> getPlagiarismHyposByCode(int code1FK)
			throws DataAccessException;

	public PlagiarismHypoTuple getPlagiarismHypo(int plagiarismHypoPK)
			throws DataAccessException;

	public CodeTuple getCode(int codePK) throws DataAccessException;

	public void setCode(CodeTuple code) throws DataAccessException;

	public List<CodeTuple> getCodeByPortionKey(int codePortionFK)
			throws DataAccessException;

	/**
	 * vsegda est’ user s loginom “admin” i parolem “nimda”.
	 */
	public void setUser(String login, String pass) throws DataAccessException;

	public String getUserPassword(String login) throws DataAccessException;

	public List<String> getUsers() throws DataAccessException;

	public void removeUser(String login) throws DataAccessException;

	public void setAlgorithm(AlgorithmTuple algo) throws DataAccessException;

	public void setPlagiarismHypo(PlagiarismHypoTuple hypo)
			throws DataAccessException;

	public Object getCodePortionLock();

	public int getLastCodePortionID() throws DataAccessException;

	public int getNextCodePortionID(int codePortionID) throws DataAccessException;

	public void commit() throws DataAccessException;

	public void rollback() throws DataAccessException;

	public void close() throws DataAccessException;
}
